package com.xuecheng.content.feignclient;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author Tang
 * @version 1.0
 * @date 2024/1/9 14:59
 */
@Slf4j
@Component
public class MediaServiceFeignClientFallback implements FallbackFactory<MediaServiceFeignClient> {
    @Override
    public MediaServiceFeignClient create(Throwable throwable) {
        return (filedata, objectName) -> {
            log.error("调用远程接口，发生熔断降级, {}", throwable.getLocalizedMessage());
            return null;
        };
    }
}
